package PersonStu.sanqi;

/**
 * @Author: Dijah
 * @Date: 2022/7/26 10:02
 * @Desc: 汉诺塔
 */
public class class01_hanoi {

    public static void main(String[] args) {
        int n = 3;

        func(n,"left","right","mid");

    }

    public static void func(int n,String from , String to ,String other){
        if(n == 1){
            System.out.println("move 1 from :"+from+" to "+to);
        }else {
            //开始递归调用
            func(n-1,from,other,to);
            System.out.println("move "+n+" from "+from + " to "+to);
            func(n-1,other,to,from);
        }

    }
}

